import * as NS from "../../../Common/NetServices";
import { IsNull } from "../../../TYLibrary/Common/GlobalExtend";
import { Wx_XSPPage } from "../../../Common/Entitys";
import { Log } from "../../../TYLibrary/System/Logger";
import { Wx_PageData, WXDataClassRuntimeDecorator } from "../../../Common/EntityBase";

@WXDataClassRuntimeDecorator()
class UserInfoPageData extends Wx_PageData {
    public ShopTextFlag: boolean = false;
    public IsShowIntroductions: boolean = false;
}

class IndexPage extends Wx_XSPPage {
    public Data: UserInfoPageData = new UserInfoPageData();

    /**
     * 初始化页面信息
     * @param {any} options
     * @returns {Promise<void>}
     * @memberof IndexPage
     */
    public async InitData(options: any): Promise<void> {
        this.EditTabBar2();
        this.Data.ShopTextFlag = false;
    }

    /**
     *
     * @param {*} e
     * @memberof IndexPage
     */
    public ShopTextHandler(e: any): void {
        if (this.Data.ShopTextFlag == false) {
            this.Data.ShopTextFlag = true;
            this.Data.ShopTextFlag = this.Data.ShopTextFlag;
            this.Data.ApplyChange(this);
        }
    }

    /**
     *
     * @param {*} e
     * @memberof IndexPage
     */
    public ConfriShopTextHandler(e: any): void {
        this.Data.ShopTextFlag = false;
        this.Data.ShopTextFlag = this.Data.ShopTextFlag;
        this.Data.ApplyChange(this);
    }

    /**
     *
     * @param {*} e
     * @memberof IndexPage
     */
    public bindIntroductions(e: any): void {
        this.Data.IsShowIntroductions = true;
        this.Data.ApplyChange(this);
    }

    /**
     *
     * @memberof IndexPage
     */
    public ConfrimNameHandler(): void {
        // console.log("名称",this.App.UserInfo.USERNAME);
        // if (!IsNullOrWhiteSpace(this.App.UserInfo.USERNAME)) {
        //     this.UpdateUser();
        //     this.Cancel();
        // } else this.ShowError("名称不能为空!");
    }

    /**
     *
     * @memberof IndexPage
     */
    public ConfrimIntroductions(): void {
        // console.log("start");
        // if (!IsNullOrWhiteSpace(this.App.UserInfo.INTRODUCTIONS)) {
        //     this.UpdateUser();
        //     this.Cancel();
        //     console.log("end");
        // } else this.ShowError("介绍内容不能为空！");
    }

    /**
     *
     * @param {*} e
     * @memberof IndexPage
     */
    public InputNameHandler(e: any): void {
        // this.App.UserInfo.USERNAME = e.detail.value;
    }

    /**
     *
     * @param {*} e
     * @memberof IndexPage
     */
    public InputIntroductionsHandler(e: any): void {
        // this.App.UserInfo.INTRODUCTIONS = e.detail.value;
    }

    /**
     * 取消
     * @param {*} e
     * @memberof IndexPage
     */
    public CancelHandler(e: any): void {
        this.Data.ShopTextFlag = false;
        this.Data.IsShowIntroductions = false;
        this.Data.ApplyChange(this);
    }
}

Page(new IndexPage());
